<template>
  <div>
    <a-input-search
      v-model="value"
      placeholder="请选择物料"
      readOnly
      unselectable="on"
      @search="onSearchLocation">
      <a-button slot="enterButton" v-show="showButton">选择物料</a-button>
    </a-input-search>
    <erp-goods-list ref="goods" @handlerOk="handlerOk"></erp-goods-list>
<!--    <j-select-goods-category-list-modal-->
<!--      ref="selectGoodsCategoryList"-->
<!--      :modal-width="modalWidth"-->
<!--      @categoryOk="selectOK"/>-->
  </div>
</template>
<script>
import ErpGoodsList from './modules/ErpGoodsListModal'
export default {
  // emits: ['update:modelValue'],
  components: { ErpGoodsList },
  props: {
    modalWidth: {
      type: Number,
      default: 1250,
      required: false
    },
    value: {
      type: String,
      required: false
    },
    showButton: {
      type: Boolean,
      required: false,
      default: true
    }
  },
  data() {
    return {
      // textVals: ''
    }
  },
  computed:{
    // textVals: {
    //   get() {
    //     return this.modelValue
    //   },
    //   set(textVals) {
    //     this.$emit('update:modelValue', textVals)
    //   }
    // }

  },
  comments: {},
  methods: {
    onSearchLocation() {
      this.$refs.location.showModal();
    },
    handlerOk(rows) {
      this.value = "";
      if (rows) {
        this.value = rows.name;
        this.$emit("handerOk", rows);
      }
    }
  }
}
</script>